package annotation;

import com.sun.jmx.snmp.Enumerated;

import java.io.FileReader;
import java.io.IOException;
import java.util.Enumeration;
import java.util.Properties;

public class Main {
    public static void main(String[] args) {
        Properties properties = new Properties();
        try {
            properties.load(new FileReader("src\\annotation\\test.properties"));
            String str = properties.getProperty("key1");
            System.out.println(str);
            @SuppressWarnings("unchecked")
            Enumeration en = properties.propertyNames();
            //迭代是无序的
            while (en.hasMoreElements()){
                String key = (String) en.nextElement();
                String value = properties.getProperty(key);
                System.out.println(key + "---->" + value);
            }

        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
